/*
 *	Copyright © 2013 Changsha kk Network Technology Co., Ltd. All rights reserved.
 *	长沙市师说网络科技有限公司 版权所有
 *	http://www.kk.com
 */

package com.hlingsoft.kkh.dao;

import com.hlingsoft.kkh.entity.Event;
import com.hlingsoft.kkh.entity.Events;
import com.hlingsoft.kkh.entity.vo.EventsVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 活动
 *
 * @author kk
 */
@Repository
public interface EventsDao {


    public EventsVo getNewestEventVo();


    public long addEvents(Events events);


    public List<Events> getOldestEvents();


    public Events getNewestEventsByUserId(@Param("appUserId") long appUserId);

    public List<Events> getEventsByUserId(@Param("appUserId") long appUserId);

    /**
     * 通过id查找
     *
     * @param id
     * @return
     */
    public Events getEventsById(@Param("id") long id);


    public Events getEventsByIdWithNone(@Param("id") long id);

    /**
     * 通过name模糊查询events
     *
     * @param name
     * @return
     */
    public List<Events> getEventsByLikeName(@Param("name") String name);



    public List<String> getEventsNameByLikeName(@Param("name") String name);

    /**
     * 通过name查找到events
     * @param name
     * @return
     */
    public List<Events> getEventsByName(@Param("name") String name);



    public Integer getEventsByNameCount(@Param("name") String name);

    /**
     * 通过用户id查找events
     *
     * @param appUserId
     * @return
     */
    public List<Events> getEventsByAppUserId(@Param("appUserId") long appUserId,@Param("offset")int offset,@Param("rows")int rows);


    public List<Events> getEventsByAppUserIdWithNone(@Param("appUserId") long appUserId);

    /**
     * 获取用户的events总数
     *
     * @param appUserId
     * @return
     */
    public long getEventsByAppUserIdCount(@Param("appUserId") long appUserId);

    /**
     * 获取所有的events
     *
     * @return
     */

    public List<Events> getAllEvents();


    public List<Events> getEventsList(@Param("offset") long offset,
                                      @Param("rows") long rows);

    public int getEventsListCount();

    /**
     * 获取点赞最多
     *
     * @return
     */
    public List<Events> getMostLikes(@Param("offset") long offset,
                                     @Param("rows") long rows);

    /**
     * 最近时段分享最多
     *
     * @return
     */
    public List<Events> getMostShare(@Param("offset") long offset,
                                     @Param("rows") long rows);

    /**
     * 最近分享最多的
     * @param offset
     * @param rows
     * @return
     */
    public List<Events> getMostShareDefault(@Param("offset") long offset,
                                     @Param("rows") long rows);

    /**
     * 获取评论最多
     *
     * @return
     */
    public List<Events> getMostEventComments(@Param("offset") long offset,
                                             @Param("rows") long rows);

    /**
     * 最新创建
     *
     * @return
     */
    public List<Events> getNewestEvents(@Param("offset") long offset,
                                        @Param("rows") long rows);



    public List<Events> getNewestEventsByAppUserId(@Param("appUserId")long appUserId, @Param("offset") long offset,
                                        @Param("rows") long rows);


    public List<Events> getNearlyEvents(@Param("appUserId") long appUserId,@Param("lt") Double lt,@Param("ln") Double ln,@Param("offset") long offset,
                                  @Param("rows") long rows);


    /**
     * 通过name查找到events
     * @param name
     * @return
     */
    public List<Events> getEventsByNameAndAddress(@Param("name") String name,@Param("createAddress") String createAddress);


    /**
     * 更新events
     * @param events
     * @return
     */
    public int updateEvents (Events events);


    /**
     * 根据用户查找发布的events
     * @param appUserId
     * @return
     */
    public List<Events> getEventsByAppUserId1(@Param("appUserId") long appUserId);


    /**
     * 获取用户所有的活动
     * @param appUserId
     * @return
     */
    public List<Events> getAllEventsByAppUserId(@Param("appUserId") long appUserId);


    /**
     * 12小时内跟图最多events
     * @return
     */
    public List<Events> getHotEvents(@Param("offset") long offset,
                                     @Param("rows") long rows);

    /**
     * 默认跟图最多的events
     * @return
     */
    public List<Events> getHotEventsDefault(@Param("offset") long offset,
                                            @Param("rows") long rows);



    public List<Events> getAllEventsList(@Param("offset") long offset,
                                         @Param("rows") long rows);

    public Integer getAllEventsListCount();


    /**
     * 获取周边
     * @return
     */
    public List<Events> getByPushName(@Param("pushName")String pushName,@Param("offset") long offset,
                                      @Param("rows") long rows);


    /**
     * 查找
     * @param pushId
     * @param interestId
     * @param offset
     * @param rows
     * @return
     */
    public List<Events> getSearch(@Param("createAddress") String createAddress,@Param("pushId")Integer pushId,@Param("interestId") String interestId,@Param("professionId") Integer professionId);



    public int getSearchCount(@Param("createAddress") String createAddress,@Param("pushId")Integer pushId,@Param("interestId") Integer interestId);



    public List<Events> getEventsWithNone(@Param("offset") long offset,@Param("rows") long rows);


    public Integer getEventsWithNoneCount();

}
